import { Injectable } from '@angular/core';
import { HOSTURL, PREFIX } from '../../../config';
import { RequestClientService } from '../../request-client.service';
@Injectable({
  providedIn: 'root'
})

export class RoleService {

  constructor(
    private requestClientService: RequestClientService
  ) { }
  // 获取角色
  public async GetRoles(params?) {
    const res = await this.requestClientService.get(HOSTURL + `/api/services/${PREFIX}/Role/GetRoles`, params);
    return res;
  }


  // 创建或修改角色
  public async CreateOrUpdateRole(params?) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Role/CreateOrUpdateRole`, params);
    return res;
  }
  // 删除角色
  public async DeleteRole(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.delete(HOSTURL + `/api/services/${PREFIX}/Role/DeleteRole`, params);
    return res;
  }
  // 获取当前编辑的角色权限点
  public async GetRoleForEdit(params?) {
    const res = await this.requestClientService.get(HOSTURL + `/api/services/${PREFIX}/Role/GetRoleForEdit`, params, {
      '.AspNetCore.Culture': 'c=zh-Hans|uic=zh-Hans',
      'Abp.TenantId': window.localStorage.getItem('TenantId'),
      'Accept-Language': 'zh-CN,zh;q=0.9'

    });
    return res;
  }
  // 批量删除角色
  public async BatchDeleteRole(params?) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Role/BatchDeleteRole`, params);
    return res;
  }

}